﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Brjostagjof.Models.ArticleViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Brjóstagjöf - Veldu flokk
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h1>Flokkar - Greinar</h1>
    <% foreach (var item in Model.categories)
       { %>
       <div>
            <h2><%: Html.ActionLink(item.Category1, "GreinarIFlokk", new { flokkur = item.Category1 }, new { @class = "sjaAllarGreinarIFlokk" }) %></h2>
            <ul>
            <% foreach (var grein in (from a in Model.articles 
                                      where a.Category == item.Category1
                                      orderby a.Date descending 
                                      select a).Take(5) )
               { %>
                    <li class ="serstokGrein"><%: Html.ActionLink(grein.Title, "SynaGrein", new{ id = grein.ID }) %></li>
                    
            <%} %>
                <li>
                    <%: Html.ActionLink("Sjá allar " + (from a in Model.articles
                                                        where a.Category == item.Category1
                                                        orderby a.Date descending
                                                        select a).Count(), 
                                        "GreinarIFlokk", new { flokkur = item.Category1 }, new { @class = "sjaAllarGreinarIFlokk" }) %>

                </li>
            </ul>            
       </div>
    <%} %>
    

</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="Actions" runat="server" >
    <%Html.RenderPartial("PartialViews/Actions", "Grein"); %>
</asp:Content>